import request from "@/utils/request";

export default {
    fileUpload(file) {
        const formData = new FormData();
        formData.append("file", file);  // 'file' 是后端期望的字段名
        return request({
            url: "/files",  // 后端接口路径
            method: "post",
            data: formData,  // 发送 FormData
        });
    },
    deleteImage(fileName) {
        return request({
            url: `/files/${fileName}`,   // 调用后端的删除接口
            method: 'delete',
        });
    },
};
